from django.db import models
from django.forms import ModelForm

TAG_CHOICES = (
  ('cpp','C++'),
  ('csharp','C#'),
  ('css','CSS'),
  ('delphi','Delphi'),
  ('java','Java'),
  ('js','JavaScript'),
  ('php','PHP'),
  ('py','Python'),
  ('rb','Ruby'),
  ('sql','SQL'),
  ('vb','VB6/VB.Net'),
  ('html','XML/HTML'),
)

class Content(models.Model):
  author        = models.IntegerField()
  author_name   = models.CharField(max_length=60)
  title         = models.TextField()
  summary       = models.TextField()
  content       = models.TextField()
  tags          = models.CharField(max_length=6,choices=TAG_CHOICES)
  publish_date  = models.DateField(auto_now_add=True)
  last_mod_date = models.DateField(auto_now=True)

class Comment(models.Model):
  content_id     = models.IntegerField()
  commenter      = models.IntegerField()
  commenter_name = models.CharField(max_length=60)
  comment        = models.TextField()
  publish_date   = models.DateField(auto_now_add=True)

class ContentForm(ModelForm):
  class Meta:
    model = Content
    exclude = ('author','author_name',)

class CommentForm(ModelForm):
  class Meta:
    model = Comment
    include = ('comment',)
